﻿// ****************************************************************************** //
//          Module for definition of cars objects and their initial state         //
// ****************************************************************************** //

module CarsTypes

open Microsoft.Xna.Framework
open Microsoft.Xna.Framework.Input
open Microsoft.Xna.Framework.Graphics
open Utilities
open Casanova
open Coroutines
open Math


type CarsState = 
  {
    Cars                : Variable<List<Car>>
    Cars2                : Variable<List<Car>>
    Cars3                : Variable<List<Car>>
    Cars4                : Variable<List<Car>>
  }

and Car =
  {
    PositionX         : Variable<float32>
    PositionY         : Variable<float32>
    PositionZ         : Variable<float32>
    mutable box       : BoundingBox
    VelX              : float32
  }
  

let mutable cars_state =  //initial state
  {
    Cars = Variable(fun () -> [])
    Cars2 = Variable(fun () -> [])
    Cars3 = Variable(fun () -> [])
    Cars4 = Variable(fun () -> [])
  }

let reset_state () =
    cars_state <-
        {
            Cars = Variable(fun () -> [])
            Cars2 = Variable(fun () -> [])
            Cars3 = Variable(fun () -> [])
            Cars4 = Variable(fun () -> [])
        }

